

var UserInfo = {
    u_name: "",
    msg_type: 0,
    u_face: null
};



var layer = layui.layer,
    form = layui.form,
    carousel = layui.carousel;

// 背景图片轮播
carousel.render({
    elem: '#login_carousel',
    width: '100%',
    height: '100%',
    interval: 3000,
    arrow: 'none',
    anim: 'fade',
    indicator: 'none'
});

/**
 * 选择头像 获取头像的Src
 * @param {} me 
 * @returns {} 
 */
function selectFace(me) {
    $(me).siblings().removeClass("faceimgCheck");
    $(me).addClass("faceimgCheck");
    UserInfo.u_face=($(me)[0].src);

}


function loginClick() {
    var u_name = $("#account").val();
    if (u_name != "" && u_name != null && UserInfo.u_face != null) {
        UserInfo.u_name = u_name;
        //需要判断用户名是否重复

        setCookie('UserInfo', JSON.stringify(UserInfo), 30);
        window.location = "index.html";


        //if (getCookie('UserInfo') != JSON.stringify(UserInfo)) {
        //    setCookie('UserInfo', JSON.stringify(UserInfo), 30);
        //    //window.location = "index.html";
        //} else {
        //    alert("用户已经存在了；只是本地cookie判断");
        //}
    } else {
        alert("请选择一个头像");
    }
}